﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhysioAssist2
{
    public partial class TabletAniversarios : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CarregaAniversariosProfissional(DateTime.Now.Month);
                CarregaAniversariosPaciente(DateTime.Now.Month);
            }
        }


        private void CarregaAniversariosProfissional(int mes)
        {

            Label lbl = new Label();

            lbl.Text = "Colegas do Hospital" + "<br />";
            lbl.CssClass = "textodestacado";


            WS ws = new WS();
            List<Profissional> lst = ws.ListaAniversariosProfissional(mes);


            if (lst.Count > 0)
                divAniversarios.Controls.Add(lbl);

            foreach (Profissional pro in lst)
            {


                Image img = new Image();
                img.CssClass = "icoAniversario";
                img.ImageUrl = "Imagens/ico_aniversario.png";
                divAniversarios.Controls.Add(img);

                lbl = new Label();
                lbl.Text = pro.nascimento.Day.ToString() + "/" + pro.nascimento.Month.ToString() + " - ";
                lbl.CssClass = "subtexto";
                divAniversarios.Controls.Add(lbl);

                lbl = new Label();
                lbl.Text = pro.nome + "<br />" + "<br />";
                lbl.CssClass = "texto";
                divAniversarios.Controls.Add(lbl);



            }

        }



        private void CarregaAniversariosPaciente(int mes)
        {

            Label lbl = new Label();

            lbl.Text = "<br />" + "<br />" + "Pacientes" + "<br />";
            lbl.CssClass = "textodestacado";


            WS ws = new WS();
            List<Paciente> lst = ws.ListaAniversariosPaciente(mes);


            if (lst.Count > 0)
                divAniversarios.Controls.Add(lbl);


            foreach (Paciente pac in lst)
            {


                Image img = new Image();
                img.CssClass = "icoAniversario";
                img.ImageUrl = "Imagens/ico_aniversario.png";
                divAniversarios.Controls.Add(img);

                lbl = new Label();
                lbl.Text = pac.nascimento.Day.ToString() + "/" + pac.nascimento.Month.ToString() + " - ";
                lbl.CssClass = "subtexto";
                divAniversarios.Controls.Add(lbl);

                lbl = new Label();
                lbl.Text = pac.nome + "<br />" + "<br />";
                lbl.CssClass = "texto";
                divAniversarios.Controls.Add(lbl);



            }

        }



    }
}